<template>
	<view><web-view :src="web_url"></web-view></view>
</template>

<script>

export default {
	data() {
		return {
			/* < 0: 默认 1: 启动页 2: 扫描 3:关于 4:功能介绍 5:下单协议 6:注册服务协议 7:合同 8:保险单 90商家合同认证 91司机合同认证  92创建商家合同 93创建司机合同 94获取商家合同 95获取司机合同 100:商家运输协议 101:司机运输协议**/
			type: '',
			web_url: '',
			navTitle: ''
		};
	},
	onLoad(options) { 
		if (options && options.type) {
			this.type = options.type; 
			switch (options.type) {
				case '1':
					this.navTitle = '答题';
					this.answer();
					break;
				case '2':
					this.navTitle = '答题';
					this.answer();
					break;
				default:
			}
			uni.setNavigationBarTitle({
				title: this.navTitle
			});
		}
	},
	methods: {
		answer() {
			var memberinfo = uni.getStorageSync(this.preutils.userinfo)
			console.log(memberinfo.id)
			if(this.type == '1'){ 
				// 'http://tlg.zygft.com/app/exam/index?userid=2001&parentid=&categoryid=';
				
				var urls =  this.baseUrl.baseUrl+'/app/exam/index?userid=';
				var userid = this.check.strNullReplace(memberinfo.id, "1");
				var other = '&parentid=&categoryid=';
				this.web_url = urls + userid + other;
				console.log(this.web_url)
			}else if(this.type == '2'){
				// http://tlg.zygft.com/app/exam/examonce/userid/2001/examid/7/tiku/311.html
				var urls = this.baseUrl.baseUrl+'/app/exam/examonce/userid/';
				var userid = this.check.strNullReplace(memberinfo.id, "1");
				var other = '/examid/7/tiku/311.html';
				this.web_url = urls + userid + other;
					console.log(this.web_url)
			}else{
				// 'http://tlg.zygft.com/app/exam/index?userid=2001&parentid=&categoryid=';
				var urls = this.baseUrl.baseUrl+'/app/exam/index?userid=';
				var userid = this.check.strNullReplace(memberinfo.id, "1");
				var other = '&parentid=&categoryid=';
				this.web_url = urls + userid + other;
			}
		}, 
		about() {
			//   关于
			this.http.sendRequest({
				api: this.api.setting.wUtilsAboutApi,
				data: {},
				success: res => {
					// console.log(res)
					if (res.success == 'true' && res.data) {
						this.url = res.data.url;
					}
				}
			});
		}, 
	}
};
</script>

<style></style>
